<?php
/**
 * 活动表
 */
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateActivityTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('activity', function (Blueprint $table) {
            $table->increments('id');
            $table->tinyInteger('type')->default(1)->comment('1:固定奖励 2随机奖励');
            $table->string('name')->nullable()->comment('活动名称');
            $table->integer('goods_num')->comment('商品个数');
            $table->text('describe')->nullable()->comment('报名规则');
            $table->timestamp('start_time')->nullable()->comment('活动开始时间');
            $table->timestamp('end_time')->nullable()->comment('活动介绍时间');
            $table->timestamp('get_time')->nullable()->comment('奖品领取截止时间');
            $table->text('rules')->comment('抽奖规则');
            $table->integer('sort')->comment('排序');
            $table->tinyInteger('status')->default(1)->comment('状态 1显示 2隐藏');
            $table->timestamps();
            $table->softDeletes();
        });
        //添加表注释
        \Illuminate\Support\Facades\DB::statement("ALTER TABLE `".config('database.connections.mysql.prefix')."activity` comment'活动表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('activity');
    }
}
